const { baseUrl, conn } = require('../config/index');
module.exports = (filePath, tab = true) => {
  let formData = {
    'ck': conn,
    'Tab': true
  }
  if (!tab) {
    formData = { 'ck': conn }
  }
  return new Promise((resolve, reject) => {
    wx.uploadFile({
      filePath: filePath,
      name: 'file',
      url: baseUrl.uploadUrl + '/wxuploader.up',
      formData,
      success: (res) => {
        if (res.statusCode == 200) {
          resolve(res)
        } else {
          reject(res)
        }
      },
      fail: (err) => {
        reject(err)
      }
    })
  })

}